package work20241203_chap6oop.k_demo9;

/**
 * @author zdl
 * @date 2024/12/3
 */
public class Soldier extends Role{
    private int hurt;
    public Soldier(){}

    public Soldier(int hurt) {
        this.hurt = hurt;
    }

    public Soldier(String name, int hurt) {
        super(name);
        this.hurt = hurt;
    }

    public int getHurt() {
        return hurt;
    }

    public void setHurt(int hurt) {
        this.hurt = hurt;
    }

    @Override
    public int attack() {
        return hurt;
    }

    @Override
    public String toString() {
        return "Soldier{" +
                "hurt=" + hurt +
                '}';
    }
}
